home *** CD-ROM | disk | FTP | other *** search
/ MacFormat UK 76 / MF_UK_76_1.iso / Education Feature / MicroWorlds 2.03 Try Me / MicroWorlds 2.03 Try Me.rsrc / TEXT_603_let.txt < prev    next >
Encoding:
Text File  |  1998-05-08  |  757 b   |  27 lines

  1. let list-of-names-and-values
  2.  
  3. Creates one or many temporary variables. The variables will exist only while the procedure containing the let instruction and procedures called by this procedure are running. The input is a list of paired variable names and values. Let can only be used in a procedure. See local.
  4.  
  5. Example: 
  6.  
  7. to move
  8. let [dist 100 head 90 delay 300]
  9. right :head
  10. wait :delay
  11. fd :dist
  12. end
  13.  
  14. Try the procedure in the Command Center. The turtle will move. When the procedure is over, check the value of the variables. Variables have lost their values. They don't even exist.
  15.  
  16. move
  17. show :dist
  18. dist has no value
  19.  
  20. The instruction let [dist 100 head 90 delay 300] is equivalent to:
  21.  
  22. local [dist head delay]
  23. make "dist 100
  24. make "head 90
  25. make "delay 300
  26.  
  27.